package com.tac.common.util;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;
import java.util.UUID;

public class imgUtil {


  public static  String getname(MultipartFile file,String Imgurl) throws IOException {
      String originalFilename = file.getOriginalFilename();
      String substring = originalFilename.substring(originalFilename.lastIndexOf("."));
      String imgName=UUID.randomUUID().toString()+substring;
      file.transferTo(new File(Imgurl+imgName));
      return "/file/"+imgName;
  }


}
